home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 March / maximum-cd-2000-03.iso / Quake3 Game Source / Q3AGameSource.exe / Main / ai_main.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  10.6 KB  |  227 lines

  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3.  
  4. /*****************************************************************************
  5.  * name:        ai_main.h
  6.  *
  7.  * desc:        Quake3 bot AI
  8.  *
  9.  * $Archive: /source/code/botai/ai_chat.c $
  10.  * $Author: Mrelusive $ 
  11.  * $Revision: 21 $
  12.  * $Modtime: 11/10/99 3:30p $
  13.  * $Date: 11/10/99 6:08p $
  14.  *
  15.  *****************************************************************************/
  16.  
  17. //#define DEBUG
  18. #define CTF
  19.  
  20. #define MAX_ITEMS                    256
  21. //bot flags
  22. #define BFL_STRAFERIGHT                1    //strafe to the right
  23. #define BFL_ATTACKED                2    //bot has attacked last ai frame
  24. #define BFL_ATTACKJUMPED            4    //bot jumped during attack last frame
  25. #define BFL_AIMATENEMY                8    //bot aimed at the enemy this frame
  26. #define BFL_AVOIDRIGHT                16    //avoid obstacles by going to the right
  27. #define BFL_IDEALVIEWSET            32    //bot has ideal view angles set
  28. #define BFL_FIGHTSUICIDAL            64    //bot is in a suicidal fight
  29. //long term goal types
  30. #define LTG_TEAMHELP                1    //help a team mate
  31. #define LTG_TEAMACCOMPANY            2    //accompany a team mate
  32. #define LTG_DEFENDKEYAREA            3    //defend a key area
  33. #define LTG_GETFLAG                    4    //get the enemy flag
  34. #define LTG_RUSHBASE                5    //rush to the base
  35. #define LTG_RETURNFLAG                6    //return the flag
  36. #define LTG_CAMP                    7    //camp somewhere
  37. #define LTG_CAMPORDER                8    //ordered to camp somewhere
  38. #define LTG_PATROL                    9    //patrol
  39. #define LTG_GETITEM                    10    //get an item
  40. #define LTG_KILL                    11    //kill someone
  41. //some goal dedication times
  42. #define TEAM_HELP_TIME                60    //1 minute teamplay help time
  43. #define TEAM_ACCOMPANY_TIME            600    //10 minutes teamplay accompany time
  44. #define TEAM_DEFENDKEYAREA_TIME        300    //5 minutes ctf defend base time
  45. #define TEAM_CAMP_TIME                600    //10 minutes camping time
  46. #define TEAM_PATROL_TIME            600    //10 minutes patrolling time
  47. #define TEAM_LEAD_TIME                600    //10 minutes taking the lead
  48. #define TEAM_GETITEM_TIME            60    //1 minute
  49. #define    TEAM_KILL_SOMEONE            180    //3 minute to kill someone
  50. #define CTF_GETFLAG_TIME            300    //5 minutes ctf get flag time
  51. #define CTF_RUSHBASE_TIME            120    //2 minutes ctf rush base time
  52. #define CTF_RETURNFLAG_TIME            180    //3 minutes to return the flag
  53. #define CTF_ROAM_TIME                60    //1 minute ctf roam time
  54. //patrol flags
  55. #define PATROL_LOOP                    1
  56. #define PATROL_REVERSE                2
  57. #define PATROL_BACK                    4
  58. //CTF task preference
  59. #define CTFTP_DEFENDER                1
  60. #define CTFTP_ATTACKER                2
  61. //CTF strategy
  62. #define CTFS_PASSIVE                1
  63. //copied from the aas file header
  64. #define PRESENCE_NONE                1
  65. #define PRESENCE_NORMAL                2
  66. #define PRESENCE_CROUCH                4
  67.  
  68. //check points
  69. typedef struct bot_waypoint_s
  70. {
  71.     int            inuse;
  72.     char        name[32];
  73.     bot_goal_t    goal;
  74.     struct        bot_waypoint_s *next, *prev;
  75. } bot_waypoint_t;
  76.  
  77. //bot state
  78. typedef struct bot_state_s
  79. {
  80.     int inuse;                                        //true if this state is used by a bot client
  81.     int botthink_residual;                            //residual for the bot thinks
  82.     int client;                                        //client number of the bot
  83.     int entitynum;                                    //entity number of the bot
  84.     playerState_t cur_ps;                            //current player state
  85.     int last_eFlags;                                //last ps flags
  86.     usercmd_t lastucmd;                                //usercmd from last frame
  87.     int entityeventTime[1024];                        //last entity event time
  88.     //
  89.     bot_settings_t settings;                        //several bot settings
  90.     int (*ainode)(struct bot_state_s *bs);            //current AI node
  91.     float thinktime;                                //time the bot thinks this frame
  92.     vec3_t origin;                                    //origin of the bot
  93.     vec3_t velocity;                                //velocity of the bot
  94.     int presencetype;                                //presence type of the bot
  95.     vec3_t eye;                                        //eye coordinates of the bot
  96.     int areanum;                                    //the number of the area the bot is in
  97.     int inventory[MAX_ITEMS];                        //string with items amounts the bot has
  98.     int tfl;                                        //the travel flags the bot uses
  99.     int flags;                                        //several flags
  100.     int respawn_wait;                                //wait until respawned
  101.     int lasthealth;                                    //health value previous frame
  102.     int lastkilledplayer;                            //last killed player
  103.     int lastkilledby;                                //player that last killed this bot
  104.     int botdeathtype;                                //the death type of the bot
  105.     int enemydeathtype;                                //the death type of the enemy
  106.     int botsuicide;                                    //true when the bot suicides
  107.     int enemysuicide;                                //true when the enemy of the bot suicides
  108.     int setupcount;                                    //true when the bot has just been setup
  109.     int entergamechat;                                //true when the bot used an enter game chat
  110.     int num_deaths;                                    //number of time this bot died
  111.     int num_kills;                                    //number of kills of this bot
  112.     int revenge_enemy;                                //the revenge enemy
  113.     int revenge_kills;                                //number of kills the enemy made
  114.     int lastframe_health;                            //health value the last frame
  115.     int lasthitcount;                                //number of hits last frame
  116.     int chatto;                                        //chat to all or team
  117.     float walker;                                    //walker charactertic
  118.     float ltime;                                    //local bot time
  119.     float entergame_time;                            //time the bot entered the game
  120.     float ltg_time;                                    //long term goal time
  121.     float nbg_time;                                    //nearby goal time
  122.     float respawn_time;                                //time the bot takes to respawn
  123.     float respawnchat_time;                            //time the bot started a chat during respawn
  124.     float chase_time;                                //time the bot will chase the enemy
  125.     float enemyvisible_time;                        //time the enemy was last visible
  126.     float check_time;                                //time to check for nearby items
  127.     float stand_time;                                //time the bot is standing still
  128.     float lastchat_time;                            //time the bot last selected a chat
  129.     float standfindenemy_time;                        //time to find enemy while standing
  130.     float attackstrafe_time;                        //time the bot is strafing in one dir
  131.     float attackcrouch_time;                        //time the bot will stop crouching
  132.     float attackchase_time;                            //time the bot chases during actual attack
  133.     float attackjump_time;                            //time the bot jumped during attack
  134.     float enemysight_time;                            //time before reacting to enemy
  135.     float enemydeath_time;                            //time the enemy died
  136.     float enemyposition_time;                        //time the position and velocity of the enemy were stored
  137.     float activate_time;                            //time to activate something
  138.     float activatemessage_time;                        //time to show activate message
  139.     float defendaway_time;                            //time away while defending
  140.     float defendaway_range;                            //max travel time away from defend area
  141.     float rushbaseaway_time;                        //time away from rushing to the base
  142.     float ctfroam_time;                                //time the bot is roaming in ctf
  143.     float killedenemy_time;                            //time the bot killed the enemy
  144.     float arrive_time;                                //time arrived (at companion)
  145.     float lastair_time;                                //last time the bot had air
  146.     float teleport_time;                            //last time the bot teleported
  147.     float camp_time;                                //last time camped
  148.     float camp_range;                                //camp range
  149.     float weaponchange_time;                        //time the bot started changing weapons
  150.     float firethrottlewait_time;                    //amount of time to wait
  151.     float firethrottleshoot_time;                    //amount of time to shoot
  152.     float notblocked_time;                            //last time the bot was not blocked
  153.     vec3_t aimtarget;
  154.     vec3_t enemyvelocity;                            //enemy velocity 0.5 secs ago during battle
  155.     vec3_t enemyorigin;                                //enemy origin 0.5 secs ago during battle
  156.     //
  157.     int character;                                    //the bot character
  158.     int ms;                                            //move state of the bot
  159.     int gs;                                            //goal state of the bot
  160.     int cs;                                            //chat state of the bot
  161.     int ws;                                            //weapon state of the bot
  162.     //
  163.     int enemy;                                        //enemy entity number
  164.     int lastenemyareanum;                            //last reachability area the enemy was in
  165.     vec3_t lastenemyorigin;                            //last origin of the enemy in the reachability area
  166.     int weaponnum;                                    //current weapon number
  167.     vec3_t viewangles;                                //current view angles
  168.     vec3_t ideal_viewangles;                        //ideal view angles
  169.     vec3_t viewanglespeed;
  170.     //
  171.     int ltgtype;                                    //long term goal type
  172.     //
  173.     int teammate;                                    //team mate
  174.     bot_goal_t teamgoal;                            //the team goal
  175.     float teammessage_time;                            //time to message team mates what the bot is doing
  176.     float teamgoal_time;                            //time to stop helping team mate
  177.     float teammatevisible_time;                        //last time the team mate was NOT visible
  178.     //
  179.     int lead_teammate;                                //team mate the bot is leading
  180.     bot_goal_t lead_teamgoal;                        //team goal while leading
  181.     float lead_time;                                //time leading someone
  182.     float leadvisible_time;                            //last time the team mate was visible
  183.     float leadmessage_time;                            //last time a messaged was sent to the team mate
  184.     float leadbackup_time;                            //time backing up towards team mate
  185.     //
  186.     char teamleader[32];                            //netname of the team leader
  187.     float askteamleader_time;                        //time asked for team leader
  188.     float becometeamleader_time;                    //time the bot will become the team leader
  189.     float teamgiveorders_time;                        //time to give team orders
  190.     float lastflagcapture_time;                        //last time a flag was captured
  191.     int numteammates;                                //number of team mates
  192.     int redflagstatus;                                //0 = at base, 1 = not at base
  193.     int blueflagstatus;                                //0 = at base, 1 = not at base
  194.     int flagstatuschanged;                            //flag status changed
  195.     int forceorders;                                //true if forced to give orders
  196.     int flagcarrier;                                //team mate carrying the enemy flag
  197.     int ctfstrategy;                                //ctf strategy
  198.     char subteam[32];                                //sub team name
  199.     float formation_dist;                            //formation team mate intervening space
  200.     char formation_teammate[16];                    //netname of the team mate the bot uses for relative positioning
  201.     float formation_angle;                            //angle relative to the formation team mate
  202.     vec3_t formation_dir;                            //the direction the formation is moving in
  203.     vec3_t formation_origin;                        //origin the bot uses for relative positioning
  204.     bot_goal_t formation_goal;                        //formation goal
  205.     bot_goal_t activategoal;                        //goal to activate (buttons etc.)
  206.     bot_waypoint_t *checkpoints;                    //check points
  207.     bot_waypoint_t *patrolpoints;                    //patrol points
  208.     bot_waypoint_t *curpatrolpoint;                    //current patrol point the bot is going for
  209.     int patrolflags;                                //patrol flags
  210. } bot_state_t;
  211.  
  212. //resets the whole bot state
  213. void BotResetState(bot_state_t *bs);
  214. //returns the number of bots in the game
  215. int NumBots(void);
  216. //returns info about the entity
  217. void BotEntityInfo(int entnum, aas_entityinfo_t *info);
  218.  
  219. // from the game source
  220. void    QDECL BotAI_Print(int type, char *fmt, ...);
  221. void    QDECL QDECL BotAI_BotInitialChat( bot_state_t *bs, char *type, ... );
  222. void    BotAI_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
  223. int        BotAI_GetClientState( int clientNum, playerState_t *state );
  224. int        BotAI_GetEntityState( int entityNum, entityState_t *state );
  225. int        BotAI_GetSnapshotEntity( int clientNum, int sequence, entityState_t *state );
  226. int        BotTeamLeader(bot_state_t *bs);
  227.